﻿using Autofac;
using Treca.Util.DllInit;
using Treca.Util.PublishSubscribe;
using Treca.CHCSDK.Services.FaceRecognition;
using Treca.Util;using System;
using Treca.CHCSDK.Services.SdkManager;
using Treca.CHCSDK.Services.FaceRecognition.Services;
using Microsoft.AspNetCore.SignalR;
using Newtonsoft.Json;
using System.Collections.Generic;
using System.Reflection;
using Newtonsoft.Json.Linq;
using Microsoft.Extensions.DependencyInjection;
using Treca.Message.Entity;

namespace Treca.Message
{

        public class MessageModule : DLLInit
    {
        public static bool IsCarAsync = false;
        public override void ConfigureContainer(ContainerBuilder builder)
        {
            builder.RegisterType<MessageEvent>();
            builder.RegisterType<SignalRLoginEvent>();
            builder.RegisterType<PushMessageEvent>();
        }
        public override void ConfigureServices(IServiceCollection service)
        {
            //service.AddTransient<MessageEvent>();
        }
        public override void DLLStart()
        {
            //CreateMoJob createMoJob = AutofacHelper.GetScopeService<CreateMoJob>();
            //createMoJob.Execute(null);
            //BaseEntity1 baseEntity = new BaseEntity1();
            //baseEntity["qwee"] = 1;
            //var json = JsonConvert.SerializeObject(baseEntity);
            //SdkPubSubCenter.AddSubscribe<MessageEvent>("SignalRLogin");
            SdkPubSubCenter.AddSubscribe<SignalRLoginEvent, string>("SignalRLogin");
            SdkPubSubCenter.AddSubscribe<PushMessageEvent, base_message>("PushMessage");
            SdkPubSubCenter.AddSubscribe<SignalRLoginEvent, string>("FlashMessage");
            //BoxCalcHelperOld.CreateBox("OKL1129-180");
            //CheckPlanHelper.CreateCheckPlan("BCK","Admin");
            //JobHelper.SetIntervalJobRun(() =>
            //{
            //    IHubContext<MessageHub> hub = AutofacHelper.GetScopeService<IHubContext<MessageHub>>();
            //    hub.Clients.All.SendAsync("PushOrderInfo",new {UserId="Admin",Process="AM"});
            //    //hub.C
            //}, new TimeSpan(0, 0, 1), new TimeSpan(0, 0, 1));
            //设备状态刷新
        }


    }
}
